package com.fuh.study.并发;

import java.util.Random;

/**
 * @创建人 fuh
 * @创建时间 2021/3/29  16:56
 * @描述
 */
public class Test {

    public synchronized static void main(String[] args) throws InterruptedException {
        while (true){
            new Thread(()->{
                try {
                    Thread.sleep(new Random().nextInt(20));
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                new claccFinalizeTest();
            }).start();
        }
    }
}

class claccFinalizeTest {
    @Override
    protected void finalize() throws Throwable {
        System.out.println("exec finalize ..");
        super.finalize();
    }
}
